<?php
include("libs/smarty.class.php");
include("functions.php");

$smarty = new Smarty();
$title = "Oferty praktyki";
$smarty->assign("title",$title);

$sql = mysql_query("SELECT
  practices.id,
  practices.add_date,
  practices.date_start,
  practices.date_end,
  practices.amount,
  practices.`status`,
  user_company.name AS company_name
FROM
  practices
  INNER JOIN user_company ON (practices.company_id = user_company.id)
WHERE
  practices.`status` = 1
ORDER BY
  practices.add_date DESC");

$practices = array();

while($row = mysql_fetch_assoc($sql)){
    $practices[] = $row;

}

$smarty->assign("practices",$practices);
$smarty->display('show_practices.tpl');
?>
